package com.yaowk.sfp.common.db;

import org.springframework.data.jpa.domain.AbstractPersistable;

import java.io.Serializable;

/**
 * Created by yaowk on 17-10-10.
 */
public abstract class BaseEntity<ID extends Serializable> extends AbstractPersistable<ID> {

    @Override
    public void setId(ID id) {
        super.setId(id);
    }

    @Override
    public boolean equals(Object obj) {
        BaseEntity<ID> entity = (BaseEntity<ID>) obj;
        return getId().equals(entity.getId());
    }

    @Override
    public int hashCode() {
        return getId().hashCode();
    }
}
